#include <iostream>
#include "iomanager.h"
#include "demo08.h"
#include "scheduler.h"
#include "fiber.h"
#include "timer.h"

void test_fiber(){
    std::cout<< "test_fiber" << std::endl;
}

void test1(){
    IOManager iom;
    iom.schedule(&test_fiber);
}

Timer::ptr s_timer;
void test_timer(){
    IOManager imo(2);
    s_timer = imo.addTimer(1000, [](){
        std::cout << "timer test" << std::endl;
        static int i = 0;
        if(++i == 3){
            s_timer->reset(2000, true);
            //s_timer->cancel();
        }
    }, true);
}

int main(int argc, char** argv){
    //test1();
    test_timer();

    return 0;
}

